class BaseResponse<T> {
  final int code;
  final String msg;
  final T? data;

  BaseResponse({
    required this.code,
    required this.msg,
    this.data,
  });

  factory BaseResponse.fromJson(Map<String, dynamic> json, T Function(dynamic)? fromJson) {
    return BaseResponse(
      code: json['code'] ?? 500,
      msg: json['msg'] ?? '',
      data: json['data'] == null ? null : fromJson?.call(json['data']),
    );
  }
} 